﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>

<?php	

	include("inc/joomlaInt.php");
	include("inc/inc_configuration.php");
	
	
	echo "<h1>Verwarnungen</h1>";
	
	$q="SELECT u.username, COUNT(*) AS anz,u.id FROM $tbl_verwarnungen v, $tbl_users u WHERE u.id=v.userId GROUP BY v.userId ORDER BY anz DESC";
	$qe=mysql_query($q);
	
	echo "	<table id='tabelle' width='400'>
				<tr><th>User</th><th>Anzahl</th></tr>";
	
	while ($row=mysql_fetch_object($qe))
	{
		$un = $row->username;
		$anz = $row->anz;
		$uid = $row->id;
		
		$un = "<a href='profil.php?id=$uid'>$un</a>";
		
		echo "	<tr>
					<td>$un</td>
					<td>$anz</td>
				</tr>";
	
	}
	
	echo "<tr><th></th><th></th></tr></table><br><br>";
	
	
	
	$q="SELECT u.username,u.id,v.reason,v.date AS datum FROM $tbl_verwarnungen v, $tbl_users u WHERE u.id=v.userId ORDER BY date DESC LIMIT 0,20";
	$qe=mysql_query($q);
	
	echo "	<table id='tabelle' width='600'>
				<tr>
					<th>User</th>
					<th>Grund</th>
					<th>Datum</th>
				</tr>";
	
	while ($row=mysql_fetch_object($qe))
	{
		$un = $row->username;
		$reason = $row->reason;
		$datum = $row->datum;
		
		$datum=date("d.m.y - H:i",$datum);
		
		echo "	<tr>
					<td>$un</td>
					<td>$reason</td>
					<td>$datum</td>
				</tr>";
	
	}
	
	echo "<tr><th></th><th></th><th></th></tr></table>";
	
	
	
?>

</body>
</html>